using System;
using facade.Factory;
using facade.Factory.FactoryMethod.Factory;
using Microsoft.AspNetCore.Mvc;
using util.AttributeExtension;
using util.EnumExtion;

namespace openapi.Controllers
{
    /// <summary>
    /// 工厂方法
    /// </summary>
    [ApiController]
    [Route("[controller]")]
    //[ApiExplorerSettings(GroupName = "FacotryMethod")]
     // [ApiGroupName("FacotryMethod")]
     [ApiGroupName(ApiGroupNameEnum.FacotryMethod)]
    public class FacotryMethodController:ControllerBase
    {
        /// <summary>
        /// 咖啡
        /// </summary>
        /// <returns></returns>
        [HttpGet("Coffee")]
        public string Coffee()
        {
            IFactory factory=new CoffeeFactory();
            IFood food=factory.Create();
            return food.Eat();
        }

        /// <summary>
        /// 土豆
        /// </summary>
        /// <returns></returns>
          [HttpGet("Tomato")]
        public string Tomato()
        {
            IFactory factory=new TomatoFactory();
            IFood food=factory.Create();
            return food.Eat();
        }
    }
}